﻿
var urlstr = '';
if (window.location.host.search("localhost") != -1) {
    urlstr = '/IFS/ifs.ashx';
}
else {
    urlstr = 'http://ifunsoccer.com/ifs/ifs.ashx';
}


function checkemail(v_val) {
    var str = v_val;
    var filter = /^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i
    if (filter.test(str))
        testresults = true
    else {
        testresults = false
    }
    return (testresults)
}

function chklogin() {
    $.ajax({
        url: 'SSEHandler.ashx',
        type: 'GET',
        dataType: "json",
        data: { method: 'chklogin' },
        success: function (data) {
            if (data.result == false) {
                window.location = "login.html";
                return false;
            } 
        }
    });
}

function logout() {
    $.ajax({
        url: 'SSEHandler.ashx',
        type: 'GET',
        dataType: "json",
        data: { method: 'logout' },
        success: function (data) {
            if (data.result == true) {
                window.location = "index.html";
                return false;
            } else {
                window.location = "index.html";
                return false;
            }
        }
    });
}

